@import "../../themes/ionic.globals.md";

// Material Design List
// --------------------------------------------------

/// @prop - Margin top of the list
$list-md-margin-top:             16px !default;

/// @prop - Margin right of the list
$list-md-margin-right:           0 !default;

/// @prop - Margin bottom of the list
$list-md-margin-bottom:          16px !default;

/// @prop - Margin left of the list
$list-md-margin-left:            0 !default;

/// @prop - Margin top of the inset list
$list-inset-md-margin-top:       16px !default;

/// @prop - Margin right of the inset list
$list-inset-md-margin-right:     16px !default;

/// @prop - Margin bottom of the inset list
$list-inset-md-margin-bottom:    16px !default;

/// @prop - Margin left of the inset list
$list-inset-md-margin-left:      16px !default;

/// @prop - Border radius of the inset list
$list-inset-md-border-radius:    2px !default;

/// @prop - Margin bottom of the header in a list
$list-md-header-margin-bottom:   13px !default;

/// @prop - Padding left of the header in a list
$list-md-header-padding-left:    $item-md-padding-left !default;

/// @prop - Minimum height of the header in a list
$list-md-header-min-height:      4.5rem !default;

/// @prop - Border top of the header in a list
$list-md-header-border-top:      1px solid $list-md-border-color !default;

/// @prop - Font size of the header in a list
$list-md-header-font-size:       1.4rem !default;

/// @prop - Text color of the header in a list
$list-md-header-color:           #757575 !default;


// Material Design Default List
// --------------------------------------------------

.list-md {
  margin: -1px $list-md-margin-right $list-md-margin-bottom $list-md-margin-left;
}

.list-md .item-block .item-inner {
  border-bottom: 1px solid $list-md-border-color;
}

.list-md > .item-block:last-child,
.list-md > .item-wrapper:last-child {
  ion-label,
  .item-inner {
    border-bottom: 0;
  }
}

.list-md > ion-input:last-child::after {
  left: 0;
}

.list-md ion-item-options {
  border-bottom: 1px solid $list-md-border-color;
}

.list-md ion-item-options .button {
  display: inline-flex;

  align-items: center;

  margin: 1px 0;

  height: calc(100% - 2px);

  border: 0;
  border-radius: 0;
  box-shadow: none;

  box-sizing: border-box;
}

.list-md ion-item-options .button::before {
  margin: 0 auto;
}

// If the item has the no-lines attribute remove the bottom border from:
// the item itself (for last-child items)
// the item-inner class (if it is not last)
.list-md .item[no-lines],
.list-md .item[no-lines] .item-inner {
  border-width: 0;
}

.list-md + ion-list ion-list-header {
  margin-top: -$list-md-margin-top;
}


// Material Design Inset List
// --------------------------------------------------

.list-md[inset] {
  margin: $list-inset-md-margin-top $list-inset-md-margin-right $list-inset-md-margin-bottom $list-inset-md-margin-left;

  border-radius: $list-inset-md-border-radius;
}

.list-md[inset] .item:first-child {
  border-top-width: 0;
  border-top-left-radius: $list-inset-md-border-radius;
  border-top-right-radius: $list-inset-md-border-radius;
}

.list-md[inset] .item:last-child {
  border-bottom-width: 0;
  border-bottom-left-radius: $list-inset-md-border-radius;
  border-bottom-right-radius: $list-inset-md-border-radius;
}

.list-md[inset] .item-input {
  padding-right: 0;
  padding-left: 0;
}

.list-md[inset] + ion-list[inset] {
  margin-top: 0;
}

.list-md[inset] ion-list-header {
  background-color: $list-md-background-color;
}


// Material Design No Lines List
// --------------------------------------------------

.list-md[no-lines] .item-block,
.list-md[no-lines] ion-item-options,
.list-md[no-lines] .item .item-inner {
  border-width: 0;
}


// Material Design List Header
// --------------------------------------------------

.list-header-md {
  margin-bottom: $list-md-header-margin-bottom;
  padding-left: $list-md-header-padding-left;

  min-height: $list-md-header-min-height;

  border-top: $list-md-header-border-top;
  font-size: $list-md-header-font-size;
  color: $list-md-header-color;
}


// Generate Material Design List Header Colors
// --------------------------------------------------

@each $color-name, $color-base, $color-contrast in get-colors($colors-md) {
  .list-header-md-#{$color-name} {
    color: $color-contrast;
    background-color: $color-base;
  }
}


// Material Design List inputs
// --------------------------------------------------

.list-md .item-input:last-child {
  border-bottom: 1px solid $list-md-border-color;
}
